//
//  SegmentViewCollectionViewCell.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/3/16.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "SegmentViewCollectionViewCell.h"
#import "SegmentViewConfigModel.h"
@interface SegmentViewCollectionViewCell()



@end

@implementation SegmentViewCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self.contentView addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView);
            make.right.equalTo(self.contentView);
            make.center.equalTo(self.contentView);
        }];
    }
    return self;
}

-(void)refreshWithSegmentViewModel:(SegmentViewConfigModel *)configModel string:(NSString *)string{
    self.titleLabel.font = configModel.font;
    self.titleLabel.textColor = configModel.color;
    self.titleLabel.text = string;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}


#pragma mark - lazy-load
-(UILabel*)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
    }
    return _titleLabel;
}

@end
